<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    input {
      color:#ccc;
    }
  </style>
</head>
<body>
  <input type="text" value="手机"/>

  <script>
    var input = document.querySelector('input')

    // 点击 onclick
    // 获取焦点  onfocus
    input.onfocus = function() {
      this.style.color = '#333'
      if( this.value === '手机' ) {
        this.value = ''
      }
    }
    // 失去焦点 onblur
    input.onblur = function() {
      this.style.color = '#ccc'
      if( this.value === '' ) {
        this.value = '手机'
      }
    }
  </script>
</body>
</html>